====== MIOS LCD Offsets ======


Some words by TK in response to [[http://www.midibox.org/forum/index.php?topic=5110.0|this question]]:
\\

The display offsets are handled by MIOS in a way which allows to use the same cursor positions on any kind of LCD. With MIOS_LCD_YAddressSet the LCD specific cursor offsets are mapped to the MIOS specific cursor offsets.\\
\\
**64 characters (0x40) are reserved for each line**, up to 4 lines are (natively) supported:\\
1st line begins at 0x00\\
2nd line begins at 0x40\\
3rd line begins at 0x80\\
4th line begins at 0xc0\\
\\
And these lines have to be mapped to the real address offsets of your LCD - this can normaly be found in the datasheet, the most common cases are documented in the functional description of MIOS_LCD_YAddressSet: [[http://www.ucapps.de/mios_fun.html#MIOS_LCD_YAddressSet]]\\
\\
For a 2x40 following settings are working:\\
Y0: 0x00\\
Y1: 0x40\\
Y2: doesn't matter (*)\\
Y3: doesn't matter (*)\\
\\
(*) note: if a value between 0x80...0xff is specified here, it is assumed that the 3rd and 4th line is mapped to a second LCD\\
\\
Centering the screen just means to add additional offsets to these addresses, e.g. let's say you've a 2x40 display, but only 16 columns are used, this means that you need to add 12 to each offset:\\
Y0: 0x00 + (40-16)/2\\
Y1: 0x40 + (40-16)/2\\
Y2: doesn't matter (*)\\
Y3: doesn't matter (*)\\
\\
Thats how MIOS supports LCDs. \\
